<script type="text/javascript">
    function checkAllList(){
       var theform = document.frmForm;
       var n = parseInt(theform.iCount.value);

       for(i=0; i<n; i++){
           if(theform.checkAll.checked){
           	  	document.getElementById("checkItem"+i).checked=true;
           }else{
           		document.getElementById("checkItem"+i).checked=false;
           }
       }
       return true;
    }

    function search(){
    	var theform = document.frmForm;
    	theform.submit();
    	return true;
    }

    function deleteAction(value){
    	var theform = document.frmForm;
    	theform.idValue.value = value;
    	theform.action = "<{$APPLICATION_URL}>/Admin/TemplateCategory/delete";
    	theform.submit();
    	return true;
    }
</script>
<form method="post" action="<{$APPLICATION_URL}>/Admin/TemplateCategory/index" name = "frmForm">
<div class="box">
	<div class="header">
		Template categories
	</div>
	<div class="body">
		<div class="panes">													
				<a href="<{$APPLICATION_URL}>/Admin/TemplateCategory/add">
					Add new category
				</a>
				<br>
				<table cellpadding="0" cellspacing="0" border="0" class="grid_table wf">
					<thead>
						<tr>
							<th>
								<div>
									<input name="checkAll" id = "checkAll" onclick="checkAllList(this);" type="checkbox" >
								</div>
							</th>
							<th>ID</th>														
							<th>Name</th>
							<th>Description</th>							
							<th>Action &nbsp;&nbsp;								
							</th>
						</tr>
					</thead>
					<tbody>
						<{assign var = i value =0}>
						<{foreach name=outer item=templateCategoryEntity from=$itemList}>
						<tr class="gradeX">
							<td>
								<div>
									<input name="checkItem<{$i}>" id="checkItem<{$i}>" value="<{$templateCategoryEntity->id}>" type="checkbox">
								</div>
							</td>
							<td><{$templateCategoryEntity->id}></td>							
							<td><{$templateCategoryEntity->name}></td>
							<td><{$templateCategoryEntity->description}></td>							
							<td class="center">
								<div style="float: right;">									
									<a href="javascript:void(0);" onclick="if (confirm('Are you sure you want to delete this record?')) { deleteAction(<{$templateCategoryEntity->id}>); } else { return false; }" class="notboldText">
										<img src="<{$APPLICATION_URL}>/Themes/Default/Images/b_drop.png" alt="" />
									</a>
									<a href="<{$APPLICATION_URL}>/Admin/TemplateCategory/edit/id/<{$templateCategoryEntity->id}>">
										<img src="<{$APPLICATION_URL}>/Themes/Default/Images/b_edit.png" alt="" />
									</a>
								</div>
							</td>
						</tr>
						<{assign var = i value = $i+1}>
						<{/foreach}>
						
					</tbody>
					<tr>
						<td colspan="13" align="right">
							<div style="float: right;">
								<input class="button" name="delete" value=" Delete " onclick="javascript: var theform = document.frmForm; theform.action = '<{$APPLICATION_URL}>/Admin/TemplateCategory/deleteall'; theform.submit(); return true;" type="button">
							</div>
						</td>
					</tr>
				</table>
				
			
		</div>
	</div>
</div>
<input type="hidden" name="iCount" id="iCount" value="<{$i}>" />
<input type="hidden" name="idValue" id="idValue" value="" />
<input type="hidden" name="masterId" id="masterId" value="<{$this->masterId}>" />
<input type="hidden" id="actionForm" name="actionForm" value="">
<input type="hidden" id="actionKey" name="actionKey" value="<{$actionKey}>">
</form>